﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CUREDataAccessLayers.Harmful;
using CUREEntity;
using System.Data;

namespace CUREBusinessLogicLayer.Harmful
{
    public class LedgerBll
    {
        LedgerDal ledgeer = new LedgerDal();
        
        /// <summary>
        /// 获取不良台账列表
        /// </summary>
        /// <param name="where"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecordCount"></param>
        /// <param name="totalPageCount"></param>
        /// <returns></returns>
        public DataSet GetLedgerList(IDictionary<string, object> where, int pageIndex, int pageSize, out int totalRecordCount, out int totalPageCount)
        {
            return ledgeer.GetLedgerList(where, pageIndex, pageSize, out totalRecordCount, out totalPageCount);
        }

        /// <summary>
        /// 根据id获取不良橡胶记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DataTable GetLedgerById(string id)
        {
            return ledgeer.GetLedgerById(id);
        }

        /// <summary>
        /// 更新台账信息
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public bool UpdateLedgerInfo(Dictionary<string, object> dic)
        {
            return ledgeer.UpdateLedgerInfo(dic);
        }

        /// <summary>
        /// 添加台账信息
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public bool AddLedgerInfo(Dictionary<string, object> dic)
        {
            return ledgeer.AddLedgerInfo(dic);
        }

        /// <summary>
        /// 更新台账状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool ChangeLedgerState(string id, int state)
        {
            return ledgeer.ChangeLedgerState(id, state);
        }

        /// <summary>
        /// 审核事务
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public bool ApprovalRoutine(Dictionary<string, object> dic)
        {
            return ledgeer.ApprovalRoutine(dic);
        }

        /// <summary>
        /// 实验申请事务
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public bool ExpApplyRoutine(Dictionary<string, object> dic)
        {
            return ledgeer.ExpApplyRoutine(dic);
        }

        /// <summary>
        /// 获取实验列表
        /// </summary>
        /// <param name="where"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecordCount"></param>
        /// <param name="totalPageCount"></param>
        /// <returns></returns>
        public DataSet GetExpList(IDictionary<string, object> where, int pageIndex, int pageSize, out int totalRecordCount, out int totalPageCount)
        {
            return ledgeer.GetExpList(where, pageIndex, pageSize, out totalRecordCount, out totalPageCount);
        }
        public DataSet GetExpListF(IDictionary<string, object> where, int pageIndex, int pageSize, out int totalRecordCount, out int totalPageCount)
        {
            return ledgeer.GetExpListF(where, pageIndex, pageSize, out totalRecordCount, out totalPageCount);
        }

        /// <summary>
        /// 根据id获取实验申请信息
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public DataTable GetExpInfo(IDictionary<string, object> where)
        {
            return ledgeer.GetExpInfo(where);
        }

        /// <summary>
        /// 根据ledgerid获取实验申请信息
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public DataTable GetExpInfoByLedgerid(IDictionary<string, object> where)
        {
            return ledgeer.GetExpInfoByLedgerid(where);
        }

        /// <summary>
        /// QA对实验结果进行审核
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public bool QAApproval(IDictionary<string, object> where)
        {
            return ledgeer.QAApproval(where);
        }

        /// <summary>
        /// 将上传文件路径存入数据库
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public bool UploadExp(IDictionary<string, object> where)
        {
            return ledgeer.UploadExp(where);
        }

         /// <summary>
        /// 根据流水号获取对应的上传文件
        /// </summary>
        /// <param name="ledgerid"></param>
        /// <returns></returns>
        public DataSet GetUploadExp(string ledgerid)
        {
            return ledgeer.GetUploadExp(ledgerid);
        }

         /// <summary>
        /// 删除文件数据库记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteFile(string id)
        {
            return ledgeer.DeleteFile(id);
        }

        /// <summary>
        /// 更改F卡信息状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public bool UpdateLedgerState(string id, string state)
        {
            return ledgeer.UpdateLedgerState(id, state);
        }

        /// <summary>
        /// 更新审核结果(技术领导审核实验完毕信息)
        /// </summary>
        /// <param name="id"></param>
        /// <param name="fid"></param>
        /// <param name="reason"></param>
        /// <returns></returns>
        public bool ExpResultSkillApproval(string id, string fid, string reason, string state)
        {
            return ledgeer.ExpResultSkillApproval(id, fid, reason, state);
        }

        /// <summary>
        /// 获取所有台账信息列表
        /// </summary>
        /// <param name="where"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecordCount"></param>
        /// <param name="totalPageCount"></param>
        /// <returns></returns>
        public DataSet GetCollectList(IDictionary<string, object> where, int pageIndex, int pageSize, out int totalRecordCount, out int totalPageCount)
        {
            return ledgeer.GetCollectList(where, pageIndex, pageSize, out totalPageCount, out totalRecordCount);
        }

        /// <summary>
        /// 获取审核信息
        /// </summary>
        /// <param name="ledgerid"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public DataTable GetApprovalInfo(string ledgerid, string type)
        {
            return ledgeer.GetApprovalInfo(ledgerid, type);
        }
    }
}
